package com.hl.qzzpbackend.model.enums;
import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 公司规模枚举
 * @author helong
 */
@Getter
public enum CompanySizeEnum {
    SIZE_0_20(0, "0-20人"),
    SIZE_20_99(1, "20-99人"),
    SIZE_100_499(2, "100-499人"),
    SIZE_500_999(3, "500-999人"),
    SIZE_1000_9999(4, "1000-9999人"),
    SIZE_10000_BBB(5, "合资企业");



    private final Integer value;
    private final String text;

    // 构造函数
    CompanySizeEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static CompanySizeEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (CompanySizeEnum companySizeEnum : CompanySizeEnum.values()) {
            if (companySizeEnum.getValue().equals(value)) {
                return companySizeEnum;
            }
        }
        return null;
    }
}